Accumulate loop dyn size #657
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Support of accumulation of dynamic sizes (
DimensionTag.dyn_size_ext
) within a recurrent context (control_flow_context
). E.g. when the dyn size (seq lengths) is of shape [B] inside the loop, and this dyn size changes in every iteration (i.e.control_flow_context
is set to the rec loop), then the accumulated dyn size outside the loop would have shape [T,B].Further, when some layer inside the loop has such a dynamic shape [B,T_per_frame], where T_per_frame is the dyn size as mentioned before, this means that we cannot use the current
TensorArray
logic, which expects that elements always have the same shape in every frame. This PR also extends that logic to support that.This was a request by #635 and also makes sense for #589, #579 (and other related commits for #391).